<template>
    <view class="container">
        <!-- <header-bar :config='config' ></header-bar> -->
        <scroll-view scroll-y class="list">
            <select-department-tree
                v-if="categoryData"
                :data="categoryData"
                :id="id"
                @selectFn="selectFn"></select-department-tree>
        </scroll-view>
    </view>
</template>

<script>
import selectDepartmentTree from "@/pages_supplier/components/select/select-department-tree.vue"
import { GetFrameworkTree } from "@/pages_supplier/service/api/store.js"
import { InitProductData } from "@/pages/api/product.js"
export default {
    components: {
        selectDepartmentTree,
    },
    data() {
        return {
            config: {
                title: "商品分类",
                centerSlot: true,
            },
            categoryData: [],
            id: 0,
            product_id: 0,
        }
    },
    onLoad(e) {
       this.product_id = e.id
       this.getinfo()
        // this.categoryData = JSON.parse(e.categoryData)
        // this.id = +e.id
        // console.log(this.categoryData)
    },
    mounted() {},
    onShow() {},
    methods: {
        getinfo() {
            let path = "?product_id=" + this.product_id
            InitProductData(path).then((res) => {
                if (res.State == 1) {
                    this.categoryData = res.Data.CategoryList
                }
            })
        },
        selectFn(data) {
            const eventChannel = this.getOpenerEventChannel()
            eventChannel.emit("getSelectData", {
                ...data,
            })
            this.easyGoBack()
        },
    },
}
</script>

<style lang="scss">
.list {
    padding-top: 24rpx;
}
</style>
